package com.example.shop.user.dao;

import com.example.shop.common.dto.Avatar;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserAvatarDao {

    @Results(id = "UserAvatarResultMap",value = {
            @Result(column = "user_id",property = "id"),
            @Result(column = "user_avatar",property = "avatar"),
    })
    @Select("select user_id,user_avatar from `user` where user_id = #{userId}")
    Avatar selectByUserId(Long userId);

    @ResultMap("UserAvatarResultMap")
    @Select("select eutp.user_id,u.user_avatar " +
            "from `user` u join r_evaluation_user_thumb_up eutp " +
            "on u.user_id = eutp.user_id " +
            "where eutp.evaluation_id = #{evaluationId}")
    List<Avatar> selectByEvaluationId(Long evaluationId);
}
